<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>系统设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header"><i class="fa fa-cog"></i> 系统设置</div>
				<div class="layui-card-body" pad15>
					<div class="layui-form" lay-filter="">
						
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:130px">自动收货天数：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[autoshdays]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.autoshdays}">
							</div>
							<div class="layui-form-mid">天</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">发货后多少天用户未确认收货自动完成收货</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:130px">自动关闭订单：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[autoclose]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.autoclose}">
							</div>
							<div class="layui-form-mid">分钟</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">下单后多久不支付自动关闭订单，释放占用的库存</div>
						</div>
						
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:130px">商品评价：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[comment]" value="1" {if $info['comment']==1}checked{/if} title="开启" lay-filter="comment"/>
								<input type="radio" name="info[comment]" value="0" {if $info['comment']==0}checked{/if} title="关闭" lay-filter="comment"/>
							</div>
						</div>
						<div class="layui-form-item" id="commentset" {if $info['comment']==0}style="display:none"{/if}>
							<label class="layui-form-label" style="width:130px">评价审核：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[comment_check]" value="1" {if $info['comment_check']==1}checked{/if} title="开启" lay-filter="comment_check"/>
								<input type="radio" name="info[comment_check]" value="0" {if $info['comment_check']==0}checked{/if} title="关闭" lay-filter="comment_check"/>
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">关闭后用户的评价将直接显示,不需要后台审核</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:130px">店铺信息：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[showjd]" value="1" {if $info['showjd']==1}checked{/if} title="显示"/>
								<input type="radio" name="info[showjd]" value="0" {if $info['showjd']==0}checked{/if} title="不显示"/>
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">商品详情页是否显示店铺信息</div>
						</div>
					<div class="layui-form-item">
						<label class="layui-form-label" style="width:130px">是否显示{:t('佣金')}：</label>
						<div class="layui-input-inline">
							<input type="radio" name="info[showcommission]" value="1" {if $info['showcommission']==1}checked{/if} title="显示"/>
							<input type="radio" name="info[showcommission]" value="0" {if $info['showcommission']==0}checked{/if} title="不显示"/>
						</div>
						<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">开启后商品详情页显示分销{:t('佣金')}</div>
					</div>

						<div class="layui-form-item">
							<label class="layui-form-label" style="width:130px">进入条件：</label>
							<div class="layui-input-inline" style="width:800px">
								<input type="checkbox" name="info[gettj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['gettj'])}checked{/if} lay-filter="gettjset"/>
								<!-- <input type="checkbox" name="info[gettj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['gettj'])}checked{/if}/> -->
								{foreach $levellist as $v}
								<input type="checkbox" name="info[gettj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['gettj'])}checked{/if}/>
								{/foreach}
							</div>
						</div>
						<div id="gettjset" {if !$info['id'] || in_array('-1',$info['gettj'])}style="display:none"{/if}>
							<div class="layui-form-item">
								<div class="layui-form-label" style="width:130px">无权限提示：</div>
								<div class="layui-input-inline">
									<input class="layui-input" name="info[gettjtip]" value="{if !$info['id']}您没有权限进入{else}{$info.gettjtip}{/if}"/>
								</div>
								<div class="layui-form-mid"></div>
							</div>
							<div class="layui-form-item">
								<div class="layui-form-label" style="width:130px">无权限跳转：</div>
								<div class="layui-input-inline">
									<input class="layui-input" name="info[gettjurl]" value="{$info.gettjurl}"/>
								</div>
								<div class="layui-btn layui-btn-primary" style="float:left" onclick="chooseUrl()">选择链接</div>
							</div>
						</div>
						 
						<div class="layui-form-item">
							<div class="layui-input-block" style="margin-left:160px;">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	layui.form.on('radio(freightfree)', function(data){
		if(data.value == '1'){
			$('#freightfreemoneyset').show();
		}else{
			$('#freightfreemoneyset').hide();
		}
	})
	layui.form.on('radio(comment)', function(data){
		if(data.value == '1'){
			$('#commentset').show();
		}else{
			$('#commentset').hide();
		}
	})
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		if(field['info[logo]'] == ''){
			dialog('请上传商家LOGO',0);return;
		}
		$.post("{:url('save')}",field,function(data){
			dialog(data.msg,data.status,data.url);
		})
	})
	
	layui.form.on('checkbox(gettjset)', function(data){
		console.log(data)
		if(data.elem.checked){
			$('#gettjset').hide();
		}else{
			$('#gettjset').show();
		}
	})
	
	function chooseUrl(){
		layer.open({type:2,shadeClose:true,area:['1100px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}"})
	}
	function chooseLink(urlname,url){
		$("input[name='info[gettjurl]']").val(url);
	}
  </script>
	{include file="public/copyright"/}
</body>
</html>